package com.aim.game;


public interface Player {

    public void onEvent(MC mc);

    public GameAction onTime(long timeFromLastEvent, MC mc);

    public double getScorePerformance();

    public int getPolicyTime();

    public static class Simple implements Player {

        long timeToMaintenance;
        double scorePerformance; // score per millis

        public Simple(long timeToMaintenance, double scorePerformance) {
            this.timeToMaintenance = timeToMaintenance;
            this.scorePerformance = scorePerformance;
        }

        @Override
        public void onEvent(MC mc) {

        }

        @Override
        public GameAction onTime(long timeFromLastEvent, MC mc) {
            if (mc != MC.FIX && timeFromLastEvent >= 0){
                return GameAction.REPAIR;
            } else if (timeFromLastEvent >= timeToMaintenance){
                return GameAction.MAINTENANCE;
            }
            return GameAction.NO_ACTION;
        }

        @Override
        public double getScorePerformance() {
            return scorePerformance;
        }

        @Override
        public int getPolicyTime() {
            return (int) timeToMaintenance;
        }
    }
}


